 rem -------------------------------------------------------------------------------------------------
 rem -- KC Operating System for the Atari 2600!
 rem -- SillyVenture 2020 demos from Mr SQL RelationalFramework.com, and a game entry too!
 rem -------------------------------------------------------------------------------------------------
 rem -- KC Operating System GUI - Display with DLI graphics /sound               
 rem -- OS navigation instructions:
 rem -- Click the Monster Icon on any of the three DLI Scroll Zones to navigate to a different Demo or Game
 rem --- DESCRIPTIONS:
 rem --- KC Operating System and Arkanoid AirHead game written in SuperCharger Disk BASIC
 rem --- KC Munchkin Demo's written in Assembly!
 rem --- (4 6K programs on the SuperCharger virtual disk for the flash cart, or on a multiload cassette tape for the SuperCharger via it's indexed filesystem, like ADAM)
 rem --- INSTRUCTIONS:
 rem -- To activate both KC Demo's to render in succession as a larger demo, click the Playah zone!
 rem -- To activate the SillyVenture Game Entry, Arkanoid AirHead, click on the bottom checker board zone!
 rem -- (losing the game will return you to the KC Operating System, hold down the button to return from the KC demo)
 rem -- Note: The KC Demos are playable - You can take control from the AI or play KC with AI assistance!
 rem -------------------------------------------------------------------------------------------------
 rem 20210208 Tracker Sequencer 8x resequencing remix - shows off Fx engine in action with a Song and an Atari 2600 KC OS phat soundtrack! :) 
 rem 20200916 Added a help system in the 2nd DLI zone (horizontal) "Select KC Zone Playah" 
 rem 20201103 Added Atari theme music from the programs, sequencer music inspired by 
 rem          Moon Patrol, Arkanoid and KC Give it Up [Extended 8" Disco Version] :)
 rem -------------------------------------------------------------------------------------------------
 rem ---- SuperCharger Disk BASIC beta release - DOS commands added to SuperCharger BASIC!
 rem ------------------------------------------------------------------------------------------------- 
 rem --- rem Disk BASIC example - how to combine four supercharger files into a single supercharger "disk":
 rem --- Steps to combine  this OS as program 0, the games are programs 1,2 and 3 as shown below, both BASIC and Assembly games can be combined:
 rem --- c:\vwBASIC>copy /b KC_OS_12_RC2.bin + KCMMII_PAL.bin+ KCPROTO.bin + ARKANOID2020.bin

 rem ----------------------------------------- 
 rem ---init section, runs once: -------------
 rem -----------------------------------------

 SUPERCHARGERID=0:rem this is the Operating System so it is now always 0... rem=3 can be anywhere usually in the init, set to zero for testing (supercharger security)
 loadplayer1(40):COLUP1=$98:rem FE
 rem NA below - this is already init to 15 below line 0 setup
 rem MUSICINDEX=0:rem 20200904 SuperCharger var may be reset on reload and actively loaded! init for button load transition delay...
 rem ------------------------------------------------
 rem end init section (implicit return)--------------
 rem ------------------------------------------------

 rem ------------------------------------------------
 rem ---gameloop subroutine, runs every frame:    ---
 rem ------------------------------------------------
 if t=0 then scrollvirtualworldtoggle=35:gosub DLI: rem run this DLI every other frame
 if t=1 then BYTErowoffset=v*12:h=BITIndex:BITIndex=u:vwpixel(29,5,bindplayer1):scrollvirtualworldtoggle=30:gosub DLI:BITIndex=h:BYTErowoffset=120 
 scrollvirtualworldtoggle=0


1 if g=0 then BYTErowoffset=120:COLUPF=$64:COLUP0=$b4:MUSICINDEX=0:g=1 
 rem ---setup complete---
  
 rem -------------------------------------------------------------
 rem end game loop (implicit return)------------------------------
 rem -------------------------------------------------------------

 rem -------------------------------------------------------------
 rem ---gameloop2 subroutine, runs every frame:    --
 rem ------------------------------------------------
 t=1-t

 rem 2x slow playback:
 rem 20210208 SUSTAINFORFRAMES=SUSTAINFORFRAMES+t: goto variableplaybackspeed
 rem if player0y>100 and 1=1 then SUSTAINFORFRAMES=SUSTAINFORFRAMES+t:goto variableplaybackspeed 
 rem 20201013 4x slow playback:
 
 rem if t=0 then r=1-r:SUSTAINFORFRAMES=SUSTAINFORFRAMES+r else SUSTAINFORFRAMES=SUSTAINFORFRAMES+t

 rem 8x slow playback:
 if t=0 then r=1-r:SUSTAINFORFRAMES=SUSTAINFORFRAMES+r else SUSTAINFORFRAMES=SUSTAINFORFRAMES+1:goto variableplaybackspeed
 rem if player0y>70 then goto variableplaybackspeed
 if r=0 then n=1-n:SUSTAINFORFRAMES=SUSTAINFORFRAMES+n
`
variableplaybackspeed
 
 if BITIndex>71 then BITIndex=255:rem overflows to 0 as intended, avoids off by 1 
 rem --- change color of words!
 rem if h>36 then goto changewordcolor
 rem for j=0 to 3:rowcolors(j)=$58:next:rowcolors(9)=$58
 rem goto donechangewordcolor 
changewordcolor
 rem for j=0 to 3:rowcolors(j)=$44:next:rowcolors(9)=$44
donechangewordcolor

 if x=255 then x=71
 if t=0 then z=1-z:x=x-z:BITIndex=BITIndex+1:h=BITIndex:BITIndex=x:scrollvirtualworldtoggle=8:gosub DLI:scrollvirtualworldtoggle=0:BITIndex=h:return else COLUPF=100
 
 rem animate Monster!
 if s>8 then s=0
 rem byterowoffset is 120 for 1st DL
 w=w+1
 if w=3 then s=s+8:loadplayer0(s):h=BITIndex:BITIndex=u:w=0:v=v+1:BYTErowoffset=v*12:vwpixel(29,5,bindplayer1):scrollvirtualworldtoggle=3:gosub DLI:scrollvirtualworldtoggle=0:BITIndex=h:return

 if v>10 then v=0:u=u+20:rem SUSTAINFORFRAMES=4
 if u>60 then u=19
 player0y=player0y+1:player0x=player0x+1
 rem BITIndex=h:rem preserved
 BYTErowoffset=120
 if joy0down=1 then player0y=player0y-2
 if joy0left=1 then player0x=player0x-3

 rem -- Navigate Directory in SuperCharger File System:
 rem -------------------------------------------------------------------------------------------------
 rem ------------ LOAD one of 3 6K SuperCharger games depending upon which zone the button is pressed!
 rem -------------------------------------------------------------------------------------------------
 if joy0fire=0 or MUSICINDEX<10 then goto skipLoad:rem basing delay on what has been initialized here :)
 rem ---superchargerindex of program to be loaded by SuperCharger ISAM file system
 if player0y<=26 then SUPERCHARGERINDEX=3:goto loadmenu:rem --- Arkanoid Airhead bottom zone
 if player0y<=56 then SUPERCHARGERINDEX=2:goto loadmenu:rem --- KC Single Screen middle zone
 SUPERCHARGERINDEX=1:rem default ----KC II top zone
 rem --------------------------
loadmenu load
 rem load can also be overloaded with an argument, examples:
 rem i=5:load i
 load 5:rem this code never reached
 rem load $a
skipLoad
 rem ---------------------------------------------------------------------


 rem -------------------------------------------------------------
 rem end gameloop2 (implicit return)----------------- 
 rem ------------------------------------------------

 rem -------------------------------------------------------------
 rem ---KITCHENSINK subroutine, runs when scrollvirtualworldtoggle=1
 rem -------------------------------------------------------------
 
 rem end kitchensink events----------------------------------------------

rowcolors $44,$44,$44,$44,$60,$60,$60,$c0,$c0,$44
                                                                                          
virtualworld
............................................................................................
............................................................................................
............................................................................................
............................................................................................
....................xxx.xxx.xxx..xxx..x.x.xx..xx...xxx..XX.XX.X.X.XX.XXx.xx.XXX.............
....................x.x..x..x.x..x.x..x.xxx..xxxx.XX.X.XX..X..X.X..X.X.X..X.X.X.............
....................x.x..x..x.x..x.x..x.Xx...xx...XX.X.XXX.XX.X.X.XX.X.X.XX.X.X.............
...................xxxx..x..xxxx.xxxx.x.xx...xx...XX.X...X..X.XXX.X..X.X.X..X.X.............
...................xx.x..x..xx.x.xx.x.x.x.Xx.xxxx.XXxX.XXX.XX.XXX.XX.XXX.Xx.XXX.............
...................xx.x..x..xx.x.xx.x.x.x.xxx.xx...xxx.xx..XX..X..XX.XXX.Xx.XxX.............
............................................................................................
............................................................................................
............................................................................................
............................................................................................
............................................................................................
.XXX.X..XXX.XXX.X.X...X.X.XXX..XX..XXX.XXX.XXX...XXX.X...X..X.X..X..X.X...XXX.X..XXX.XXX.X.X 
.X...X...X..X...XX....XX..X.....X..X.X.X.X.XX....XXX.X..XXX..X..XXX.XXX...X...X...X..X...XX.
.XXX.XX.XXX.XXX.X.X...X.X.XXX...XX.XXX.X.X.XXX...X...XX.X.X..X..X.x.X.X...XXX.XX.XXX.XXX.X.X 
.....X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.XxX.X.X.XxX.X.XxX.X.XxX.X.X.X...XxX.X.X.X.X.X.X.X.X.X
....X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.XxXxX.X.XxXxX.XxXxX.XxXxX.X.X.X.X.X.X.X.X.X.X.X.X.X.X.

sprites
0
..X...X.
..XXXXX.
..X.X.X.
..XXXXXX
.X.XXX.X
.XX...XX
XXXXXXXX
XXX.....
8
..X...X.
..XXXXX.
..X.X.X.
..XXXXXX
.X.....X
.XX...XX
XXXXXXXX
...XXX..
16
..X...X.
..XXXXX.
..X.X.X.
..XXXXXX
.XXXXXXX
.X.....X
XXXXXXXX
.....XXX
24
x...xx..
...XXXX.
X....XXX
XXX.....
..X..XX.
X.X.XXXX
Xx...XX.
...x....
32
..xxxx..
.xXXXXx.
XXX.xxXX
XxXxx.XX
xXXXXX.x
XXX..XXX
XxxxxxxX
..xxxx..
40
X.xxxx.X
.xXXXXx.
XX.xx.XX
XxxxxxXX
x.XXXX.x
XX....XX
.xxxxxx.
..xxxx..
48
xxxxxxxx
xx....XX
Xx....XX
XX....xx
xxxx..xx
Xxxx..XX
Xxxx..xx
xxxxxxxx
56x
..xxx...
.xxxx...
..xxx...
..xxx...
..xxx...
.xxxxx..
.xxxxx..
.xxxxx..
64
........
xxxxxxxx
......xx
......xx
xxxxxxxx
xxxx....
xxxx....
xxxxxxxx
72
xxxxxxx.
......x.
......x.
......x.
xxxxxxxx
......xx
......xx
xxxxxxxx
80
xx......
xx......
xx......
xx...xx.
xxxxxxx.
.....xx.
.....xx.
.....xx.
88
........
xxxxxxxx
xx......
xx......
xxxxxxxx
....xxxx
....xxxx
xxxxxxxx
96
........
xxxxxxxx
xx....xx
xx......
xxxxxxxx
xx....xx
xxxx..xx
xxxxxxxx
104
xxxxxxxx
xxxxxxxx
xx...xxx
....xxx.
...xxx..
...xxx..
...xxx..
...xxx..
112
.xxxxxx.
.x....X.
.x....X.
XXxxxxxx
xx....xx
Xxxx..XX
Xxxx..xx
xxxxxxxx
120
xxxxxxxx
x.....xx
x....xxx
xxxxxxxx
......xx
......xx
......xx
......xx
19g
17a
26d

x12
26g
23a
17d

chiptunes


6,27,6,13,8
6,27,6,13,8
6,24,6,20,8
6,24,6,20,8
6,22,6,22,8


0,0,0,0,8

6,22,6,22,8
6,22,6,22 ,8
6,24,6,20,8
6,24,6,20,8
6,13,6,27,12


0,0,0,16,16


12,26,12,26,16
12,26,12,26,8

12,23,12,11,8
12,23,12,2,8

12,17,12,17,8
0,0,0,0,16


0,0,0,0,16

AIR
HEAD
4,31,12,23,8
4,31,12,23,8
4,20,12,1,32
4,23,12,23,8
4,24,12,24,8
4,27,12,27,8
4,24,12,24,8

4,27,12,18,8
4,27,12,18,4
4,27,12,18,4
4,27,12,18,8
4,27,12,18,8
4,27,12,18,8

0,0,0,0,16

6,27,6,13,8
6,27,6,13,8
6,24,6,20,8
6,24,6,20,8
6,22,6,22,8


0,0,0,0,16

6,22,6,22,8
6,22,6,22,8
6,24,6,20,8
6,24,6,20,8
6,13,6,27,12 


MOON
PTRL
4,31,4,5,8
0,0,0,0,8

4,17,4,8,8
4,17,4,8,8

4,19,7,30,8
4,19,7,30,8

4,23,4,14,8
4,23,4,14,8
4,19,4,4,8

4,31,4,5,8
0,0,0,0,8

4,17,4,8,8
4,17,4,8,16
4,19,7,30,8
4,23,4,14,16
4,19,4,4,24   

RPT
0,0,0,0,32

0,0,0,0,0           